# Contributor: Matthias Ahouansou <matthias@ahouansou.cz>
# Maintainer: Matthias Ahouansou <matthias@ahouansou.cz>
pkgname=trunk
pkgver=0.20.1
pkgrel=0
pkgdesc="Build, bundle & ship your Rust WASM application to the web"
url="https://trunkrs.dev"
arch="all !s390x" # nix
license="MIT OR Apache-2.0"
makedepends="
	bzip2-dev
	cargo
	cargo-auditable
	openssl-dev
"
depends="
	rust
	wasm-bindgen
"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/trunk-rs/trunk/archive/refs/tags/v$pkgver.tar.gz
"
options="net"

prepare() {
	default_prepare
	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen
}

check() {
	cargo test --frozen -- --skip tools::tests::download_and_install_binaries
}

package() {
	install -Dm 755 target/release/trunk "$pkgdir"/usr/bin/trunk

	for l in APACHE MIT
	do
		install -Dm 644 LICENSE-"$l" "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE-"$l"
	done
}

sha512sums="
7888984bcbca7d6448db3c73260fb9cf45390a4c394ca1c699e1c3e615d1f58e807f005f4518c572f5a166472f835660fdeaed970a4d2985087c6ee98972440b  trunk-0.20.1.tar.gz
"
